<?php

namespace app\models\Child;

use Yii;

/**
 * This is the model class for table "t_order_service_detail".
 *
 * @property integer $rel_id
 * @property string $booking_no
 * @property integer $order_id
 * @property string $order_no
 * @property integer $service_type
 * @property integer $service_id
 * @property string $cashier_id
 * @property string $user_id
 * @property string $doctor_id
 * @property string $subclinic_id
 * @property integer $patient_id
 * @property integer $order_num
 * @property string $service_name
 * @property string $service_img
 * @property string $service_cost
 * @property string $service_income
 * @property string $service_sum_cost
 * @property string $service_sum_income
 * @property string $create_time
 */
class TDegreeInfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 't_degree_info';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['degree_id', 'user_id', 'patient_id', 'doctor_id', 'treatment_count','is_over','last_subclinic'], 'integer'],
            [['create_time','last_time'], 'safe'],
            [['degree_no'], 'string', 'max' => 32]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'patient_id' => 'Patient ID',
            'user_id' => 'User Id',
            'degree_id' => 'Degree Age',
            'doctor_id' => 'Degree Gender',
            'treatment_count' => 'Treatment Count',
            'is_over' => 'Is Over',
            'last_subclinic' => 'Last Subclinic',
            'last_time' => 'Last Time',
            'degree_no' => 'Degree No'
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUserPatientDegreeList()
    {
        return $this->hasMany(TDegreeInfo::className(), ['patient_id' => 'patient_id']);
    }
}
